<!DOCTYPE html5>
<html lang="zh" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8">
    <title>全部功能</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <script type="text/javascript" src="//lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
    <link href="../css/loding.css" rel="stylesheet">
</head>
<script type="text/javascript">
    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        WeixinJSBridge.call('hideOptionMenu');
    });
    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        WeixinJSBridge.call('hideToolbar');
    });

    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
                    (i[r].q = i[r].q || []).push(arguments)
                }, i[r].l = 1 * new Date();
        a = s.createElement(o),
                m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

    ga('create', 'UA-80548840-1', 'auto');
    ga('send', 'pageview');

</script>
<style type="text/css">
    body {
        height: 100%;
        width: 100%;
        padding: 0;
        margin: 0;
        background-color: whitesmoke;
    }

    .section {
        margin: 5em 0;
    }

    .box {
        padding: 1em;
        border: 1px solid #DDD;
        box-shadow: 1px 1px 1px #1111111;
        border-radius: 5px;
    }

    .top { margin-bottom: 15px; }

    #ballsWaveG {
        position:absolute;
        top: 50%;
        left: 50%;
        margin-top:-15px;
        margin-left:-80px;
        width: 160px;
        height: 30px;
        z-index: 100;
    }
    /* Sticky footer styles
        -------------------------------------------------- */

    .footer {
        position: absolute;
        bottom: 0;
        /* Set the fixed height of the footer here */
        height: 50px;
        padding-top: 10px;
    }
</style>
<script>
    function get_CET() {
        url = "/CET";
        $.ajax({
            //提交数据的类型 POST GET
            type: "GET",
            //提交的网址
            url: url,
            //返回数据的格式
            datatype: "json",//"xml", "html", "script", "json", "jsonp", "text".
            //在请求之前调用的函数
            beforeSend: function () {
                $('#ballsWaveG').show();
                $("#msg").text("");
                $("#msg-sm").hide();
            },
            //成功返回之后调用的函数
            success: function (data) {
                html = "";
                list = JSON.parse(data)
                for (index in list) {
                    html += list[index].join("<br/><br/>");
                    html += "<hr>"
                }
                $("#center").html(html);
                $("#msg").text("");
                $('#icon-text').text("返回继续查询");
                $("#before_button").css('width', '6.4em');

                $("#before_button").attr("onclick", 'location="/"');
                $('#ballsWaveG').hide();
                $('.footer').hide();
                document.title = "查询结果--ebtbu";
            },
            //调用出错执行的函数
            error: function () {
                $("#msg").html("请求失败,联系我们吧~~");
                $('#ballsWaveG').hide();
            }
        });
    }

    function go(idname, url) {
        var select = document.getElementById(idname)
        var value = select.options[select.selectedIndex].value

        $.ajax({
            //提交数据的类型 POST GET
            type: "POST",
            //提交的网址
            url: url,
            //提交的数据
            data: {term: value},
            //返回数据的格式
            datatype: "html",//"xml", "html", "script", "json", "jsonp", "text".
            //在请求之前调用的函数
            beforeSend: function () {
                $('#ballsWaveG').show();
                $("#msg").text("");
                $("#msg-sm").hide();
            },
            //成功返回之后调用的函数
            success: function (data) {
                $("#center").html(data);
                $("#msg").text("");
                $('#icon-text').text("返回继续查询");
                $("#before_button").css('width', '6.4em');

                $("#before_button").attr("onclick", 'location="/"');
                $('#ballsWaveG').hide();
                $('.footer').hide();
                document.title = "查询结果--ebtbu";
            },
            //调用出错执行的函数
            error: function () {
                $("#msg").addClass("text-danger");
                $("#msg").html("请求失败,再试一下吧");
                $('#ballsWaveG').hide();
            }
        });
    }

    function traffic() {
        url = '/traffic';
        $.ajax({
            //提交数据的类型 POST GET
            type: "POST",
            //提交的网址
            url: url,
            //返回数据的格式
            datatype: "json",//"xml", "html", "script", "json", "jsonp", "text".
            //在请求之前调用的函数
            beforeSend: function () {
                $('#ballsWaveG').show();
                $("#msg").text("");
                $("#msg-sm").html("");
            },
            //成功返回之后调用的函数
            success: function (data) {
                $("#msg").text("");
                $('#ballsWaveG').hide();
                result = JSON.parse(data);
                $("#traffic").text("已使用"+result[0] + "MB;套餐" + result[1] + "MB");
                $("#traffic").attr('disabled','disabled');
                $("#traffic").attr('onclick','');

            },
            //调用出错执行的函数
            error: function () {
                $("#msg").addClass("text-danger");
                $("#msg").html("请求失败,再试一下吧");
                $("#ballsWaveG").hide();
                $("#traffic").html()
            }
        });
    }
</script>
<body>
<div class="container-fluid">
<div id="ballsWaveG" hidden="hidden" class="row col-md-6 col-md-offset-3 col-xs-10 col-xs-offset-1">
    <div id="ballsWaveG_1" class="ballsWaveG"></div>
    <div id="ballsWaveG_2" class="ballsWaveG"></div>
    <div id="ballsWaveG_3" class="ballsWaveG"></div>
    <div id="ballsWaveG_4" class="ballsWaveG"></div>
    <div id="ballsWaveG_5" class="ballsWaveG"></div>
    <div id="ballsWaveG_6" class="ballsWaveG"></div>
    <div id="ballsWaveG_7" class="ballsWaveG"></div>
    <div id="ballsWaveG_8" class="ballsWaveG"></div>
</div>
    <!-- 顶部 -->
    <div class="navbar">
        <!-- 图标 -->
        <a id="before_button" class="btn btn-lg  img-circle col-xs-2 col-md-1" onclick="location='/logout'">
            <i style="font-size:2em;" class="glyphicon glyphicon-circle-arrow-left" aria-hidden="true"></i>
        </a>
        <h4 style="line-height:2em;" id="icon-text">注销(重新登录)</h4>
    </div>
    <!-- 中心 -->
    <!-- 消息栏,ajax栏 -->
    <div class="" id="center">
        <div class="text-center row">
            <h4 id="msg" class="text-info">不注销的话,下次就不用再登录了哦</h4>
            <h4 id="msg-sm" class="text-info"><small>新学期课表出来啦~</small></h4>
        </div>
        <div class="section row" style="margin-top: 2em;">
            <div class="col-md-6 col-md-offset-3 col-xs-10 col-xs-offset-1 box">
                <div>
                    <h4 class="pagetitle text-center">查成绩:</h4>
                </div>
                <div class="">
                    <p class="col-xs-3 form-control-static" for="score">学期 :</p>
                    <div class="col-xs-6" style="padding-left:0;">
                        <select class="form-control" name="term" id="score" required="required">
                            <option value="2016-2017-1" selected="selected">本学期</option>
                            <option value="2015-2016-2">上学期</option>
                            <option value="2015-2016-1">上上学期</option>
                            <option value="2014-2015-2">2014-2015-2</option>
                            <option value="2014-2015-1">2014-2015-1</option>
                            <option value="2013-2014-2">2013-2014-2</option>
                            <option value="2013-2014-1">2013-2014-1</option>
                            <option value="2012-2013-2">2012-2013-2</option>
                            <option value="2012-2013-1">2012-2013-1</option>
                        </select>
                    </div>
                    <a onclick="go('score','/score')" class="btn btn-primary col-xs-3" role="button">go</a>
                </div>
            </div>
        </div>

        <!-- 下半部分 -->
        <div class="section row">
            <div class="col-md-6 col-md-offset-3 col-xs-10 col-xs-offset-1 box">
                <div>
                    <h4 class="text-center">查课表:</h4>
                </div>
                <div class="">
                    <p class="col-xs-3 form-control-static" for="timetable">学期 :</p>
                    <div class="col-xs-6" style="padding-left:0;">
                        <select class="form-control" name="term" id="timetable" required="required">
                            <option value="2016-2017-2" selected="selected">新学期</option>
                            <option value="2016-2017-1">本学期</option>
                            <option value="2015-2016-2">上学期</option>
                            <option value="2015-2016-1">上上学期</option>
                            <option value="2014-2015-2">2014-2015-2</option>
                            <option value="2014-2015-1">2014-2015-1</option>
                            <option value="2013-2014-2">2013-2014-2</option>
                            <option value="2013-2014-1">2013-2014-1</option>
                            <option value="2012-2013-2">2012-2013-2</option>
                            <option value="2012-2013-1">2012-2013-1</option>
                        </select>
                    </div>
                    <a onclick="go('timetable','/timetable')" class="btn btn-primary col-xs-3" role="button">go</a>
                </div>
            </div>
        </div>

        <div class="section text-center row">
            <!--<div id="traffi" class="col-md-3 col-md-offset-3 col-xs-10 col-xs-offset-1 top">-->
                <!--<a id="traffic" onclick="traffic()" class="btn btn-primary btn-rounded btn-block btn-md">校园网流量查询</a>-->
            <!--</div>-->
            <div class="col-md-6 col-md-offset-3 col-xs-10 col-xs-offset-1">
                <a onclick="get_CET()" class="btn btn-primary btn-rounded btn-block btn-md">四六级成绩查询(无需账号)</a>
            </div>
        </div>
    </div>
    <!-- 底部 -->
    <footer class="text-center row col-xs-12">
        <div class="">
            <p class="text-muted">©2016-2017 eBTBU by 张晓林.</p>
        </div>
    </footer>
</div>
</body>
</html>
